<script>
   $(document).ready(function(){
       $("#category_id").change(function(){
           var category_id = $(this).val();
           $.ajax({
                   type: "POST",
                   url:"<?php echo  base_url();?>administrator/get_version",
                   data: "category_id="+category_id,
                   success: function(msg){
                           $("#version_id").html("");
                           $("#version_id").html(msg);
                   }
                });
       })
   })
</script>
<div id="center-column">
                        <div class="top-bar">
                                <a href="<?php echo  base_url();?>administrator/receive_add" class="button">新增</a>
                                <h1>Contents</h1>
                                <div class="breadcrumbs"><?php echo anchor('main/index','首页');?> /<?php echo anchor('administrator/receive_add','添加接收记录');?></div>
                        </div>
                        
                  <div class="table add_table">
                                
                                
                                <table class="listing form" cellpadding="0" cellspacing="0">
                                  <?php if(isset($id)){echo form_open('administrator/receive_edit/'.$id);}else{echo form_open('administrator/receive_add');}?>
                                        <tr>
                                                <th class="full" colspan="2">编辑接收记录</th>
                                                <input type='hidden' name="pre_count"  value="<?php echo $receive->count;?>" />
                                                <input type='hidden' name="mod_id"  value="<?php echo $receive->mod_id;?>" />
                                                <input type='hidden' name="category_id"  value="<?php echo $receive->category_id;?>" />
                                        </tr>
                                        <tr>
                                                <td class="first" width="172"><strong>型号：</strong></td>
                                                <td class="last"><select name="mod_id" id="mod_id" disabled=true>
                                                                   <option value="">请选择型号</option>
                                                                   <?php foreach($mod as $k=>$val):?>
                                                                     <option value="<?php echo $val->mod_id;?>" <?php if(isset($id)){ if($val->mod_id==$receive->mod_id){?>selected<?php } }?>><?php echo $val->name;?></option>
                                                                   <?php endforeach;?>
                                                                 </select><font color="#FF0000">编辑状态下，型号，资料种类，资料版本不可以更改</font></td>
                                        </tr>
                                        <tr>
                                                <td class="first" width="172"><strong>资料类别：</strong></td>
                                                <td class="last"><select name="category_id" id="category_id" disabled=true>
                                                                   <option value="">请选择资料类别</option>
                                                                   <?php foreach($category as $k=>$val):?>
                                                                     <option value="<?php echo $val->category_id;?>" <?php if(isset($id)){ if($val->category_id==$receive->category_id){?>selected<?php } }?>><?php echo $val->name;?></option>
                                                                   <?php endforeach;?>
                                                                 </select></td>
                                        </tr>
                                        <tr>
                                           <td class="first"><strong>当前版本：</strong></td>
                                           <td class="last"><select name="version_id" id="version_id" <?php if(isset($id)){ ?>disabled=true <?php }?>>
                                                              
                                                        <?php if(isset($id)){?>
                                                               <option value="">请选择资料版本</option>
                                                                   <?php foreach($version as $k=>$val):?>
                                                                     <option value="<?php echo $val->version_id;?>" <?php if(isset($id)){ if($val->version_id==$receive->version_id){?>selected<?php } }?>><?php echo $val->name;?></option>
                                                                   <?php endforeach;}?>
                                                            </select>
                                           </td>
                                        </tr>
                                        <tr class="bg">
                                                <td class="first"><strong>接收单号：</strong></td>
                                                <td class="last"><input type="text" class="text" name="codes" value="<?php if(isset($id)){echo $receive->codes;}?>" /></td>
                                        </tr>
                                        <tr class="bg">
                                                <td class="first"><strong>接收数量：</strong></td>
                                                <td class="last"><input type="text" class="text" name="count" <?php if(isset($id)){?><?php }?> value="<?php if(isset($id)){echo $receive->count;}?>" /></td>
                                        </tr>
                                        <tr class="bg">
                                                <td class="first""><strong>接收人：</strong></td>
                                                <td class="last"><input type="text" name="contacter" value="<?php echo $receive->contacter;?>" />
                                                </td>
                                        </tr>
                                        
                                        <tr>
                                               <td colspan="2" style="text-align:center;"><input type="submit" value="提交" class="button" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="button" value="返回" class="button" onclick="location.href='<?php echo site_url()?>administrator/receive'" /></td>                  
                                        </tr>
                                </form> 
                                </table>
                <p>&nbsp;</p>
                  </div>
                </div>
        </div>
        <div id="footer"></div>
</div>



</body>
</html>
